from selenium.webdriver.common.by import By

from web.framework.base_page import BasePage
from web.pages.search_page import SearchPage


class IndexPage(BasePage):
    def __init__(self, driver=None):
        super().__init__(driver)
        self.driver.get('https://ceshiren.com/')

    def search(self):
        """高级搜索"""
        search_btn = (By.CSS_SELECTOR, '[title="搜索"]')
        advanced_search_btn = (By.CSS_SELECTOR, '[title="打开高级搜索"]')
        self.click(search_btn)
        self.click(advanced_search_btn)
        return SearchPage(self.driver)

    def create_topic(self):
        """新建话题"""
        create_btn = (By.ID, 'create-topic')
        self.click(create_btn)
        ...
